package com.test.redis;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

public class JedisPoolUtil {

    private JedisPoolUtil(){}

    private static volatile JedisPool jedisPool = null ;

    public static JedisPool getJedisPoolInstance(){
        if(null == jedisPool){
            synchronized (JedisPoolUtil.class){
                if(null == jedisPool){
                    JedisPoolConfig config=new JedisPoolConfig();
                    jedisPool = new JedisPool(config,"127.0.0.1",6379);
                }
            }
        }
        return jedisPool;
    }
}
